package dfbz.封装优化;

public class animal {
    private String name;
    private int age;
    private String sex;

    public animal(String name, int age, String sex) { //满参
        this.name = name;
        this.age = age;
        this.sex = sex;
    }
    public animal(){ //无参
        System.out.println("无参调用了");
    }
    public void printMessage(){
        System.out.println("名字为:"+this.name+" "+"年龄为:"+this.age+" "+"性别为:"+this.sex);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
}
